<template>
  <div class="project-container">
    <div class="item" v-for="(item, index) in list" :key="index">
      <img :src="item.imgUrl" class="pic" />
      <div class="content">
        <h2>{{item.title}}</h2>
        <p>{{item.text}}</p>
        <div class="bottom flex">
          <span>{{item.time}}小时前</span>
          <div class="avatar-wrapper">
            <span v-for="(img, imgIndex) in item.avatars" :key="imgIndex">
              <img :src="img" />
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import {projectlist} from '../mock/center'

let list = []
const avatars = [
  require(`@/assets/img/avatar.jpg`),
  require(`@/assets/img/avatar.jpg`),
  require(`@/assets/img/avatar.jpg`)
]
list = projectlist.map(item => ({...item, avatars}))
</script>

<style scoped lang="scss">
.project-container {
  display: grid;
  margin-top: 30px;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 35px;
  .item {
    width: 100%;
    transition: all .3s;
    border: 1px solid #f0f0f0;
    &:hover {
      cursor: pointer;
      box-shadow: 0 0 18px 0 rgba(24, 144, 255, .25);
    }
    &:hover h2 {
      cursor: pointer;
      color: $primary-color !important;
    }
    .pic {
      @include wh(100%, 223px);
    }
    .content {
      padding: 24px;
      h2 {
        font-weight: bold;
        margin-bottom: 4px;
        @include sc($font-size-medium-x, rgba(0,0,0,.85));
      }
      p {
        height: 44px;
        overflow: hidden;
        line-height: 22px;
        color: rgba(0,0,0,.45);
      }
      .bottom {
        justify-content: space-between;
        span {
          @include sc($font-size-small, rgba(0,0,0,.485));
        }
        .avatar-wrapper {
          img {
            @include wh(24px, 24px);
            @include borderRadius(50%);
            margin-left: -8px;
            &:hover {
              cursor: pointer;
            }
          }
        }
      }
    }
  }
}
</style>
